package jdbc;

import java.sql.Connection;
import java.sql.PreparedStatement;
import java.sql.SQLException;

public class Test4 {
    public static void main(String[] args) {
        try (
                Connection connection=DBUtil.getConnection();
        ){
            String sql="UPDATE userinfo SET password=? WHERE username=?";
            PreparedStatement ps=connection.prepareStatement(sql);
            ps.setString(1,"6666666");
            ps.setString(2,"王克晶");
            int count=ps.executeUpdate();
            if(count>0){
                System.out.println("修改成功");
            }else {
                System.out.println("修改失败");
            }

        } catch (SQLException e) {
            e.printStackTrace();
        }
    }
}
